import React,{useState,useEffect} from 'react';
import  AllHeader  from "../header";
import AllFooter from "../footer";
// import { allStore } from "../../store/AllStore";
import "./index.css"
import  FactoryContent from "./content"
function Factory() {
    const [change,setChange] = useState(false);
    const [headerColor,setHeaderColor] = useState(undefined);
    useEffect(() => {  
        const handleScroll = () => {  
          const position = document.documentElement.scrollTop;  
          if(position>300){
            setHeaderColor("#fff")
          }
          else{
            setHeaderColor(undefined)
          }
        };  
      
        window.addEventListener('scroll', handleScroll);  
      
        // 清理函数，在组件卸载时移除事件监听器  
        return () => {  
          window.removeEventListener('scroll', handleScroll);  
        };  
      }, []); 

    const Change = () => {
        setChange(!change)
    }
    return <>
    <AllHeader  color={headerColor} allPageFlase={Change} />
    < FactoryContent/>
     <AllFooter/>
    </>
}
export default Factory
